<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of xuly
 *
 * @author Trung
 */
class Process extends CI_Controller {

    public function __construct() {
        parent::__construct();
    }

    public function index() {
        
    }

    public function pro_form() {


        $Ten_dmMauDon = $_POST['Ten_dmMauDon'];
        $Ten_dmMauDon = strtolower(str_replace(' ', '_', $this->common->loaibodau($Ten_dmMauDon)));
        $data['filename'] = 'form/' . $Ten_dmMauDon;
        $this->load->view('htmldoc/'.$Ten_dmMauDon, $data);
    }

    public function print_newhtml() {

        $data = $this->session->all_userdata();
        $this->load->view('htmldoc/chung_nhan_sinh_vien', $data);
    }

    public function create_excel() {
        
    }

    public function insert_donsv($data) {
        if (TRUE) {
            echo 'Bạn đã Gủi thanh công';

            $str = var_export($data, true);

            echo '<pre>';
            print_r($this->common->convertArray($str));
            echo '</pre>';
        }
    }

    public function pro_form_submit() {
        $submit = $_POST['submit'];
        switch ($submit) {
            case "Xem Trước":
                $this->print_newhtml();

                break;
            case "Tạo Excel":
                $this->create_excel();
                $this->load->view('home');
                break;
            case "Gửi":

                $this->insert_donsv($_POST);
                break;
            default:
                $this->load->view("home");
                break;
        }
    }
    public function check_user(){
        
    }
}
?>
